{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d385b5c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2e852cd0",
   "metadata": {
    "lines_to_next_cell": 2
   },
   "outputs": [],
   "source": [
    "df = pd.read_excel('./data/demo_04.xlsx', sheet_name='Sheet1')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0decfe26",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>日期</th>\n",
       "      <th>销量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2021-01-01</td>\n",
       "      <td>6961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-01-02</td>\n",
       "      <td>2047</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-01-03</td>\n",
       "      <td>4205</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2021-01-04</td>\n",
       "      <td>1159</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-01-05</td>\n",
       "      <td>8988</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          日期    销量\n",
       "0 2021-01-01  6961\n",
       "1 2021-01-02  2047\n",
       "2 2021-01-03  4205\n",
       "3 2021-01-04  1159\n",
       "4 2021-01-05  8988"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "55db08de",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(181, 2)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "6f67b00d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>日期</th>\n",
       "      <th>销量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2021-01-01</td>\n",
       "      <td>6961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-01-02</td>\n",
       "      <td>2047</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-01-03</td>\n",
       "      <td>4205</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2021-01-04</td>\n",
       "      <td>1159</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-01-05</td>\n",
       "      <td>8988</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>2021-06-26</td>\n",
       "      <td>5822</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>2021-06-27</td>\n",
       "      <td>4317</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>178</th>\n",
       "      <td>2021-06-28</td>\n",
       "      <td>4971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>179</th>\n",
       "      <td>2021-06-29</td>\n",
       "      <td>3742</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>180</th>\n",
       "      <td>2021-06-30</td>\n",
       "      <td>1309</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>181 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            日期    销量\n",
       "0   2021-01-01  6961\n",
       "1   2021-01-02  2047\n",
       "2   2021-01-03  4205\n",
       "3   2021-01-04  1159\n",
       "4   2021-01-05  8988\n",
       "..         ...   ...\n",
       "176 2021-06-26  5822\n",
       "177 2021-06-27  4317\n",
       "178 2021-06-28  4971\n",
       "179 2021-06-29  3742\n",
       "180 2021-06-30  1309\n",
       "\n",
       "[181 rows x 2 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "26cba3a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>日期</th>\n",
       "      <th>销量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2021-01-01</td>\n",
       "      <td>6961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-01-02</td>\n",
       "      <td>2047</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-01-03</td>\n",
       "      <td>4205</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2021-01-04</td>\n",
       "      <td>1159</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-01-05</td>\n",
       "      <td>8988</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>2021-06-26</td>\n",
       "      <td>5822</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>2021-06-27</td>\n",
       "      <td>4317</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>178</th>\n",
       "      <td>2021-06-28</td>\n",
       "      <td>4971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>179</th>\n",
       "      <td>2021-06-29</td>\n",
       "      <td>3742</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>180</th>\n",
       "      <td>2021-06-30</td>\n",
       "      <td>1309</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>181 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            日期    销量\n",
       "0   2021-01-01  6961\n",
       "1   2021-01-02  2047\n",
       "2   2021-01-03  4205\n",
       "3   2021-01-04  1159\n",
       "4   2021-01-05  8988\n",
       "..         ...   ...\n",
       "176 2021-06-26  5822\n",
       "177 2021-06-27  4317\n",
       "178 2021-06-28  4971\n",
       "179 2021-06-29  3742\n",
       "180 2021-06-30  1309\n",
       "\n",
       "[181 rows x 2 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7b4309d8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cb361d34",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "ec1e638d",
   "metadata": {},
   "source": [
    "# 数据偏移"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d485606b",
   "metadata": {},
   "source": [
    "## shift函数\n",
    "- 销量增长率 = (本期销量 - 上期销量) / 上期销量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "7dcdb773",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销量</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>6961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2047</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>4205</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>1159</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-05</th>\n",
       "      <td>8988</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-26</th>\n",
       "      <td>5822</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-27</th>\n",
       "      <td>4317</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-28</th>\n",
       "      <td>4971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-29</th>\n",
       "      <td>3742</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-30</th>\n",
       "      <td>1309</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>181 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              销量\n",
       "日期              \n",
       "2021-01-01  6961\n",
       "2021-01-02  2047\n",
       "2021-01-03  4205\n",
       "2021-01-04  1159\n",
       "2021-01-05  8988\n",
       "...          ...\n",
       "2021-06-26  5822\n",
       "2021-06-27  4317\n",
       "2021-06-28  4971\n",
       "2021-06-29  3742\n",
       "2021-06-30  1309\n",
       "\n",
       "[181 rows x 1 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = df.set_index('日期')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a33ecf03",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销量</th>\n",
       "      <th>上期销量</th>\n",
       "      <th>销量增长率</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>6961</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2047</td>\n",
       "      <td>6961.0</td>\n",
       "      <td>-0.705933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>4205</td>\n",
       "      <td>2047.0</td>\n",
       "      <td>1.054226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>1159</td>\n",
       "      <td>4205.0</td>\n",
       "      <td>-0.724376</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-05</th>\n",
       "      <td>8988</td>\n",
       "      <td>1159.0</td>\n",
       "      <td>6.754961</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              销量    上期销量     销量增长率\n",
       "日期                                \n",
       "2021-01-01  6961     NaN       NaN\n",
       "2021-01-02  2047  6961.0 -0.705933\n",
       "2021-01-03  4205  2047.0  1.054226\n",
       "2021-01-04  1159  4205.0 -0.724376\n",
       "2021-01-05  8988  1159.0  6.754961"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['上期销量'] = df['销量'].shift(periods=1,freq='D')\n",
    "df['销量增长率'] = (df['销量']-df['上期销量'])/df['上期销量']\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "e1fa5201",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销量</th>\n",
       "      <th>上期销量</th>\n",
       "      <th>销量增长率</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>6961</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2047</td>\n",
       "      <td>6961.0</td>\n",
       "      <td>-0.705933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>4205</td>\n",
       "      <td>2047.0</td>\n",
       "      <td>1.054226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>1159</td>\n",
       "      <td>4205.0</td>\n",
       "      <td>-0.724376</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-05</th>\n",
       "      <td>8988</td>\n",
       "      <td>1159.0</td>\n",
       "      <td>6.754961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-26</th>\n",
       "      <td>5822</td>\n",
       "      <td>6863.0</td>\n",
       "      <td>-0.151683</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-27</th>\n",
       "      <td>4317</td>\n",
       "      <td>5822.0</td>\n",
       "      <td>-0.258502</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-28</th>\n",
       "      <td>4971</td>\n",
       "      <td>4317.0</td>\n",
       "      <td>0.151494</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-29</th>\n",
       "      <td>3742</td>\n",
       "      <td>4971.0</td>\n",
       "      <td>-0.247234</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-06-30</th>\n",
       "      <td>1309</td>\n",
       "      <td>3742.0</td>\n",
       "      <td>-0.650187</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>181 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              销量    上期销量     销量增长率\n",
       "日期                                \n",
       "2021-01-01  6961     NaN       NaN\n",
       "2021-01-02  2047  6961.0 -0.705933\n",
       "2021-01-03  4205  2047.0  1.054226\n",
       "2021-01-04  1159  4205.0 -0.724376\n",
       "2021-01-05  8988  1159.0  6.754961\n",
       "...          ...     ...       ...\n",
       "2021-06-26  5822  6863.0 -0.151683\n",
       "2021-06-27  4317  5822.0 -0.258502\n",
       "2021-06-28  4971  4317.0  0.151494\n",
       "2021-06-29  3742  4971.0 -0.247234\n",
       "2021-06-30  1309  3742.0 -0.650187\n",
       "\n",
       "[181 rows x 3 columns]"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f83c3834",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "885cc5ce",
   "metadata": {},
   "source": [
    "## diff函数\n",
    "- 偏移后计算差异"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "35f0d3cb",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "056e646b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销量</th>\n",
       "      <th>上期销量</th>\n",
       "      <th>销量增长率</th>\n",
       "      <th>diff</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>6961</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2047</td>\n",
       "      <td>6961.0</td>\n",
       "      <td>-0.705933</td>\n",
       "      <td>-4914.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>4205</td>\n",
       "      <td>2047.0</td>\n",
       "      <td>1.054226</td>\n",
       "      <td>2158.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>1159</td>\n",
       "      <td>4205.0</td>\n",
       "      <td>-0.724376</td>\n",
       "      <td>-3046.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-05</th>\n",
       "      <td>8988</td>\n",
       "      <td>1159.0</td>\n",
       "      <td>6.754961</td>\n",
       "      <td>7829.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              销量    上期销量     销量增长率    diff\n",
       "日期                                        \n",
       "2021-01-01  6961     NaN       NaN     NaN\n",
       "2021-01-02  2047  6961.0 -0.705933 -4914.0\n",
       "2021-01-03  4205  2047.0  1.054226  2158.0\n",
       "2021-01-04  1159  4205.0 -0.724376 -3046.0\n",
       "2021-01-05  8988  1159.0  6.754961  7829.0"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['diff'] = df['销量'].diff(periods=1)\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "aa0df85c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "日期\n",
       "2021-01-01       NaN\n",
       "2021-01-02   -4914.0\n",
       "2021-01-03    2158.0\n",
       "2021-01-04   -3046.0\n",
       "2021-01-05    7829.0\n",
       "Name: diff, dtype: float64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['diff'].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a0b5f113",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销量</th>\n",
       "      <th>上期销量</th>\n",
       "      <th>销量增长率</th>\n",
       "      <th>diff</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>6961</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2047</td>\n",
       "      <td>6961.0</td>\n",
       "      <td>-0.705933</td>\n",
       "      <td>-4914.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>4205</td>\n",
       "      <td>2047.0</td>\n",
       "      <td>1.054226</td>\n",
       "      <td>2158.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>1159</td>\n",
       "      <td>4205.0</td>\n",
       "      <td>-0.724376</td>\n",
       "      <td>-3046.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-05</th>\n",
       "      <td>8988</td>\n",
       "      <td>1159.0</td>\n",
       "      <td>6.754961</td>\n",
       "      <td>7829.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              销量    上期销量     销量增长率    diff\n",
       "日期                                        \n",
       "2021-01-01  6961     NaN       NaN     NaN\n",
       "2021-01-02  2047  6961.0 -0.705933 -4914.0\n",
       "2021-01-03  4205  2047.0  1.054226  2158.0\n",
       "2021-01-04  1159  4205.0 -0.724376 -3046.0\n",
       "2021-01-05  8988  1159.0  6.754961  7829.0"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "c777da7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['pct'] = df['diff'] / df['上期销量']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "44c84783",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销量</th>\n",
       "      <th>上期销量</th>\n",
       "      <th>销量增长率</th>\n",
       "      <th>diff</th>\n",
       "      <th>pct</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>6961</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2047</td>\n",
       "      <td>6961.0</td>\n",
       "      <td>-0.705933</td>\n",
       "      <td>-4914.0</td>\n",
       "      <td>-0.705933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>4205</td>\n",
       "      <td>2047.0</td>\n",
       "      <td>1.054226</td>\n",
       "      <td>2158.0</td>\n",
       "      <td>1.054226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>1159</td>\n",
       "      <td>4205.0</td>\n",
       "      <td>-0.724376</td>\n",
       "      <td>-3046.0</td>\n",
       "      <td>-0.724376</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-05</th>\n",
       "      <td>8988</td>\n",
       "      <td>1159.0</td>\n",
       "      <td>6.754961</td>\n",
       "      <td>7829.0</td>\n",
       "      <td>6.754961</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              销量    上期销量     销量增长率    diff       pct\n",
       "日期                                                  \n",
       "2021-01-01  6961     NaN       NaN     NaN       NaN\n",
       "2021-01-02  2047  6961.0 -0.705933 -4914.0 -0.705933\n",
       "2021-01-03  4205  2047.0  1.054226  2158.0  1.054226\n",
       "2021-01-04  1159  4205.0 -0.724376 -3046.0 -0.724376\n",
       "2021-01-05  8988  1159.0  6.754961  7829.0  6.754961"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6082eade",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e884d45b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "5e6fe18c",
   "metadata": {},
   "source": [
    "## pct_change函数\n",
    "- 偏移后计算差异百分比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "3de0c8c7",
   "metadata": {
    "lines_to_next_cell": 2
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销量</th>\n",
       "      <th>上期销量</th>\n",
       "      <th>销量增长率</th>\n",
       "      <th>diff</th>\n",
       "      <th>pct</th>\n",
       "      <th>pct_change</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>6961</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2047</td>\n",
       "      <td>6961.0</td>\n",
       "      <td>-0.705933</td>\n",
       "      <td>-4914.0</td>\n",
       "      <td>-0.705933</td>\n",
       "      <td>-0.705933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>4205</td>\n",
       "      <td>2047.0</td>\n",
       "      <td>1.054226</td>\n",
       "      <td>2158.0</td>\n",
       "      <td>1.054226</td>\n",
       "      <td>1.054226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>1159</td>\n",
       "      <td>4205.0</td>\n",
       "      <td>-0.724376</td>\n",
       "      <td>-3046.0</td>\n",
       "      <td>-0.724376</td>\n",
       "      <td>-0.724376</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-05</th>\n",
       "      <td>8988</td>\n",
       "      <td>1159.0</td>\n",
       "      <td>6.754961</td>\n",
       "      <td>7829.0</td>\n",
       "      <td>6.754961</td>\n",
       "      <td>6.754961</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              销量    上期销量     销量增长率    diff       pct  pct_change\n",
       "日期                                                              \n",
       "2021-01-01  6961     NaN       NaN     NaN       NaN         NaN\n",
       "2021-01-02  2047  6961.0 -0.705933 -4914.0 -0.705933   -0.705933\n",
       "2021-01-03  4205  2047.0  1.054226  2158.0  1.054226    1.054226\n",
       "2021-01-04  1159  4205.0 -0.724376 -3046.0 -0.724376   -0.724376\n",
       "2021-01-05  8988  1159.0  6.754961  7829.0  6.754961    6.754961"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['pct_change'] = df['销量'].pct_change(periods=1,freq='D')\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "108081c0",
   "metadata": {},
   "source": [
    "## rolling函数\n",
    "- 滚动计算，计算近3天平均销量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "0d88f4a1",
   "metadata": {
    "lines_to_next_cell": 0
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>销量</th>\n",
       "      <th>上期销量</th>\n",
       "      <th>销量增长率</th>\n",
       "      <th>diff</th>\n",
       "      <th>pct</th>\n",
       "      <th>pct_change</th>\n",
       "      <th>近3天平均销量</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日期</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-01-01</th>\n",
       "      <td>6961</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-02</th>\n",
       "      <td>2047</td>\n",
       "      <td>6961.0</td>\n",
       "      <td>-0.705933</td>\n",
       "      <td>-4914.0</td>\n",
       "      <td>-0.705933</td>\n",
       "      <td>-0.705933</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-03</th>\n",
       "      <td>4205</td>\n",
       "      <td>2047.0</td>\n",
       "      <td>1.054226</td>\n",
       "      <td>2158.0</td>\n",
       "      <td>1.054226</td>\n",
       "      <td>1.054226</td>\n",
       "      <td>4404.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-04</th>\n",
       "      <td>1159</td>\n",
       "      <td>4205.0</td>\n",
       "      <td>-0.724376</td>\n",
       "      <td>-3046.0</td>\n",
       "      <td>-0.724376</td>\n",
       "      <td>-0.724376</td>\n",
       "      <td>2470.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-01-05</th>\n",
       "      <td>8988</td>\n",
       "      <td>1159.0</td>\n",
       "      <td>6.754961</td>\n",
       "      <td>7829.0</td>\n",
       "      <td>6.754961</td>\n",
       "      <td>6.754961</td>\n",
       "      <td>4784.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              销量    上期销量     销量增长率    diff       pct  pct_change      近3天平均销量\n",
       "日期                                                                           \n",
       "2021-01-01  6961     NaN       NaN     NaN       NaN         NaN          NaN\n",
       "2021-01-02  2047  6961.0 -0.705933 -4914.0 -0.705933   -0.705933          NaN\n",
       "2021-01-03  4205  2047.0  1.054226  2158.0  1.054226    1.054226  4404.333333\n",
       "2021-01-04  1159  4205.0 -0.724376 -3046.0 -0.724376   -0.724376  2470.333333\n",
       "2021-01-05  8988  1159.0  6.754961  7829.0  6.754961    6.754961  4784.000000"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['近3天平均销量'] = df['销量'].rolling(window=3).mean()\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "9d2bb484",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4404.333333333333"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(6961+2047+4205)/3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "5a2e6cf0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2470.3333333333335"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(2047+4205+1159)/3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "27225532",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4784.0"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(8988+4205+1159)/3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c4fcfd25",
   "metadata": {},
   "source": [
    "# 数据切分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "8349e1ae",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wall time: 19.9 ms\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "tb = pd.read_excel('./data/demo_04.xlsx', sheet_name='Sheet2')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "74fd5805",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>学号</th>\n",
       "      <th>成绩</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A001</td>\n",
       "      <td>93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A002</td>\n",
       "      <td>35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A003</td>\n",
       "      <td>54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>A004</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>A005</td>\n",
       "      <td>53</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     学号  成绩\n",
       "0  A001  93\n",
       "1  A002  35\n",
       "2  A003  54\n",
       "3  A004  76\n",
       "4  A005  53"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "41188a5d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.frame.DataFrame"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(tb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "10a3ea77",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].min()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "3d722182",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "119"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a320323d",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "916adb32",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b8f91780",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "aa20693e",
   "metadata": {},
   "source": [
    "## cut函数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ff30575f",
   "metadata": {},
   "source": [
    "### 指定箱数，等距分箱\n",
    "- 10组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "700ee09a",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "716ef766",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[36.4, 48.2)        17\n",
       "[107.2, 119.118)    15\n",
       "[1.0, 12.8)         11\n",
       "[24.6, 36.4)        10\n",
       "[71.8, 83.6)        10\n",
       "[60.0, 71.8)         9\n",
       "[95.4, 107.2)        9\n",
       "[48.2, 60.0)         7\n",
       "[12.8, 24.6)         6\n",
       "[83.6, 95.4)         6\n",
       "Name: 等距分箱, dtype: int64"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['等距分箱'] = pd.cut(x=tb['成绩'],bins=10,right=False)\n",
    "tb['等距分箱'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "85e64c58",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0         [83.6, 95.4)\n",
       "1         [24.6, 36.4)\n",
       "2         [48.2, 60.0)\n",
       "3         [71.8, 83.6)\n",
       "4         [48.2, 60.0)\n",
       "            ...       \n",
       "95        [60.0, 71.8)\n",
       "96        [60.0, 71.8)\n",
       "97        [24.6, 36.4)\n",
       "98    [107.2, 119.118)\n",
       "99         [1.0, 12.8)\n",
       "Name: 等距分箱, Length: 100, dtype: category\n",
       "Categories (10, interval[float64]): [[1.0, 12.8) < [12.8, 24.6) < [24.6, 36.4) < [36.4, 48.2) ... [71.8, 83.6) < [83.6, 95.4) < [95.4, 107.2) < [107.2, 119.118)]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['等距分箱']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "18f8dd6d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>学号</th>\n",
       "      <th>成绩</th>\n",
       "      <th>等距分箱</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A001</td>\n",
       "      <td>93</td>\n",
       "      <td>[83.6, 95.4)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A002</td>\n",
       "      <td>35</td>\n",
       "      <td>[24.6, 36.4)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A003</td>\n",
       "      <td>54</td>\n",
       "      <td>[48.2, 60.0)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>A004</td>\n",
       "      <td>76</td>\n",
       "      <td>[71.8, 83.6)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>A005</td>\n",
       "      <td>53</td>\n",
       "      <td>[48.2, 60.0)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>A096</td>\n",
       "      <td>68</td>\n",
       "      <td>[60.0, 71.8)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>A097</td>\n",
       "      <td>61</td>\n",
       "      <td>[60.0, 71.8)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>A098</td>\n",
       "      <td>33</td>\n",
       "      <td>[24.6, 36.4)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>A099</td>\n",
       "      <td>117</td>\n",
       "      <td>[107.2, 119.118)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>A100</td>\n",
       "      <td>7</td>\n",
       "      <td>[1.0, 12.8)</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      学号   成绩              等距分箱\n",
       "0   A001   93      [83.6, 95.4)\n",
       "1   A002   35      [24.6, 36.4)\n",
       "2   A003   54      [48.2, 60.0)\n",
       "3   A004   76      [71.8, 83.6)\n",
       "4   A005   53      [48.2, 60.0)\n",
       "..   ...  ...               ...\n",
       "95  A096   68      [60.0, 71.8)\n",
       "96  A097   61      [60.0, 71.8)\n",
       "97  A098   33      [24.6, 36.4)\n",
       "98  A099  117  [107.2, 119.118)\n",
       "99  A100    7       [1.0, 12.8)\n",
       "\n",
       "[100 rows x 3 columns]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1415ff70",
   "metadata": {},
   "source": [
    "### 指定区间分箱\n",
    "- [0, 60, 80, 100, 120]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "3f588ac0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "不及格    51\n",
       "优秀     22\n",
       "一般     17\n",
       "良好     10\n",
       "Name: 指定区间分箱, dtype: int64"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['指定区间分箱'] = pd.cut(x=tb['成绩'],bins=[0, 60, 80, 100, 120],\n",
    "                      labels=['不及格','一般','良好','优秀'],right=False)\n",
    "tb['指定区间分箱'].value_counts()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "b070c4a8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      良好\n",
       "1     不及格\n",
       "2     不及格\n",
       "3      一般\n",
       "4     不及格\n",
       "     ... \n",
       "95     一般\n",
       "96     一般\n",
       "97    不及格\n",
       "98     优秀\n",
       "99    不及格\n",
       "Name: 指定区间分箱, Length: 100, dtype: category\n",
       "Categories (4, object): ['不及格' < '一般' < '良好' < '优秀']"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['指定区间分箱']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "cf70937b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>学号</th>\n",
       "      <th>成绩</th>\n",
       "      <th>等距分箱</th>\n",
       "      <th>指定区间分箱</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A001</td>\n",
       "      <td>93</td>\n",
       "      <td>[83.6, 95.4)</td>\n",
       "      <td>良好</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A002</td>\n",
       "      <td>35</td>\n",
       "      <td>[24.6, 36.4)</td>\n",
       "      <td>不及格</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A003</td>\n",
       "      <td>54</td>\n",
       "      <td>[48.2, 60.0)</td>\n",
       "      <td>不及格</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>A004</td>\n",
       "      <td>76</td>\n",
       "      <td>[71.8, 83.6)</td>\n",
       "      <td>一般</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>A005</td>\n",
       "      <td>53</td>\n",
       "      <td>[48.2, 60.0)</td>\n",
       "      <td>不及格</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>A096</td>\n",
       "      <td>68</td>\n",
       "      <td>[60.0, 71.8)</td>\n",
       "      <td>一般</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>A097</td>\n",
       "      <td>61</td>\n",
       "      <td>[60.0, 71.8)</td>\n",
       "      <td>一般</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>A098</td>\n",
       "      <td>33</td>\n",
       "      <td>[24.6, 36.4)</td>\n",
       "      <td>不及格</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>A099</td>\n",
       "      <td>117</td>\n",
       "      <td>[107.2, 119.118)</td>\n",
       "      <td>优秀</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>A100</td>\n",
       "      <td>7</td>\n",
       "      <td>[1.0, 12.8)</td>\n",
       "      <td>不及格</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      学号   成绩              等距分箱 指定区间分箱\n",
       "0   A001   93      [83.6, 95.4)     良好\n",
       "1   A002   35      [24.6, 36.4)    不及格\n",
       "2   A003   54      [48.2, 60.0)    不及格\n",
       "3   A004   76      [71.8, 83.6)     一般\n",
       "4   A005   53      [48.2, 60.0)    不及格\n",
       "..   ...  ...               ...    ...\n",
       "95  A096   68      [60.0, 71.8)     一般\n",
       "96  A097   61      [60.0, 71.8)     一般\n",
       "97  A098   33      [24.6, 36.4)    不及格\n",
       "98  A099  117  [107.2, 119.118)     优秀\n",
       "99  A100    7       [1.0, 12.8)    不及格\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab455ce1",
   "metadata": {},
   "source": [
    "## qcut函数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2d6d5a2a",
   "metadata": {},
   "source": [
    "### 指定分位数，等频分箱\n",
    "- 4组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "f7742887",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.999, 34.75]    25\n",
       "(34.75, 55.5]     25\n",
       "(55.5, 94.25]     25\n",
       "(94.25, 119.0]    25\n",
       "Name: 等频分组, dtype: int64"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['等频分组']=pd.qcut(x=tb['成绩'],q=4)\n",
    "tb['等频分组'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "ec6f0e18",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "成绩    34.75\n",
       "Name: 0.25, dtype: float64"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb.quantile(0.25)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "0c234dc6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Interval(94.25, 119.0, closed='right')"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['等频分组'].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "cb7fc77d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>学号</th>\n",
       "      <th>成绩</th>\n",
       "      <th>等距分箱</th>\n",
       "      <th>指定区间分箱</th>\n",
       "      <th>等频分组</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A001</td>\n",
       "      <td>93</td>\n",
       "      <td>[83.6, 95.4)</td>\n",
       "      <td>良好</td>\n",
       "      <td>(55.5, 94.25]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A002</td>\n",
       "      <td>35</td>\n",
       "      <td>[24.6, 36.4)</td>\n",
       "      <td>不及格</td>\n",
       "      <td>(34.75, 55.5]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A003</td>\n",
       "      <td>54</td>\n",
       "      <td>[48.2, 60.0)</td>\n",
       "      <td>不及格</td>\n",
       "      <td>(34.75, 55.5]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>A004</td>\n",
       "      <td>76</td>\n",
       "      <td>[71.8, 83.6)</td>\n",
       "      <td>一般</td>\n",
       "      <td>(55.5, 94.25]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>A005</td>\n",
       "      <td>53</td>\n",
       "      <td>[48.2, 60.0)</td>\n",
       "      <td>不及格</td>\n",
       "      <td>(34.75, 55.5]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>A096</td>\n",
       "      <td>68</td>\n",
       "      <td>[60.0, 71.8)</td>\n",
       "      <td>一般</td>\n",
       "      <td>(55.5, 94.25]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>A097</td>\n",
       "      <td>61</td>\n",
       "      <td>[60.0, 71.8)</td>\n",
       "      <td>一般</td>\n",
       "      <td>(55.5, 94.25]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>A098</td>\n",
       "      <td>33</td>\n",
       "      <td>[24.6, 36.4)</td>\n",
       "      <td>不及格</td>\n",
       "      <td>(0.999, 34.75]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>A099</td>\n",
       "      <td>117</td>\n",
       "      <td>[107.2, 119.118)</td>\n",
       "      <td>优秀</td>\n",
       "      <td>(94.25, 119.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>A100</td>\n",
       "      <td>7</td>\n",
       "      <td>[1.0, 12.8)</td>\n",
       "      <td>不及格</td>\n",
       "      <td>(0.999, 34.75]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      学号   成绩              等距分箱 指定区间分箱            等频分组\n",
       "0   A001   93      [83.6, 95.4)     良好   (55.5, 94.25]\n",
       "1   A002   35      [24.6, 36.4)    不及格   (34.75, 55.5]\n",
       "2   A003   54      [48.2, 60.0)    不及格   (34.75, 55.5]\n",
       "3   A004   76      [71.8, 83.6)     一般   (55.5, 94.25]\n",
       "4   A005   53      [48.2, 60.0)    不及格   (34.75, 55.5]\n",
       "..   ...  ...               ...    ...             ...\n",
       "95  A096   68      [60.0, 71.8)     一般   (55.5, 94.25]\n",
       "96  A097   61      [60.0, 71.8)     一般   (55.5, 94.25]\n",
       "97  A098   33      [24.6, 36.4)    不及格  (0.999, 34.75]\n",
       "98  A099  117  [107.2, 119.118)     优秀  (94.25, 119.0]\n",
       "99  A100    7       [1.0, 12.8)    不及格  (0.999, 34.75]\n",
       "\n",
       "[100 rows x 5 columns]"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a86a2b62",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "9248ddf9",
   "metadata": {},
   "source": [
    "### 指定分位数区间分箱\n",
    "- [0, 0.3, 0.5, 0.75, 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "870228c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "tb['指定分位数区间分箱'] = pd.qcut(x=tb['成绩'],q=[0, 0.3, 0.5, 0.75, 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "34710351",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.999, 38.7]     30\n",
       "(55.5, 94.25]     25\n",
       "(94.25, 119.0]    25\n",
       "(38.7, 55.5]      20\n",
       "Name: 指定分位数区间分箱, dtype: int64"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['指定分位数区间分箱'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "fb1ebdc8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "94.25"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].quantile(0.75)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "4e7d7d9f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "34.75"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].quantile(0.25)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "536a723b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "59.5"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].quantile(0.75)-tb['成绩'].quantile(0.25)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "27e33162",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "59.5"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "94.25-34.75"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "3a1dd69f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "119.0"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].quantile(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "7104cffc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "63.5"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].quantile(1)-tb['成绩'].quantile(0.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f69f0bb3",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "1027e2fb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].quantile(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "96ece4f8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "119"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "d8873072",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].min()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "084809b9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "55.5"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "f3ad18c5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "55.5"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb['成绩'].quantile(0.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "eb02098a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "error\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    print(2/0)\n",
    "except:\n",
    "    print('error')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "65f305e3",
   "metadata": {},
   "outputs": [],
   "source": [
    "from scipy.interpolate import interp1d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3440d748",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "221a6d48",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "18dc5d58",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "6dd18b39",
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.rcParams['font.sans-serif']='SimHei'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "217868b5",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "6462cc32",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_input=pd.read_excel(r'C:\\Users\\pwh\\Desktop\\双十一淘宝数据分析\\工作簿1(1).xlsx',sheet_name='input')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "ba3dbfd1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>循环圈数</th>\n",
       "      <th>容量衰减率</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>50</td>\n",
       "      <td>0.982470</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>100</td>\n",
       "      <td>0.973241</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>200</td>\n",
       "      <td>0.960564</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>300</td>\n",
       "      <td>0.951553</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>500</td>\n",
       "      <td>0.936783</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>800</td>\n",
       "      <td>0.917917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1000</td>\n",
       "      <td>0.905131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1135</td>\n",
       "      <td>0.896654</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   循环圈数     容量衰减率\n",
       "0     1  1.000000\n",
       "1    50  0.982470\n",
       "2   100  0.973241\n",
       "3   200  0.960564\n",
       "4   300  0.951553\n",
       "5   500  0.936783\n",
       "6   800  0.917917\n",
       "7  1000  0.905131\n",
       "8  1135  0.896654"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_input"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1e1411b1",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_require=pd.read_excel(r'C:\\Users\\pwh\\Desktop\\双十一淘宝数据分析\\工作簿1(1).xlsx',sheet_name='要求')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "d76480ac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>循环圈数</th>\n",
       "      <th>容量衰减率</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1.000250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>0.999858</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>0.999316</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0.998557</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1130</th>\n",
       "      <td>1131</td>\n",
       "      <td>0.896848</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1131</th>\n",
       "      <td>1132</td>\n",
       "      <td>0.896777</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1132</th>\n",
       "      <td>1133</td>\n",
       "      <td>0.896700</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1133</th>\n",
       "      <td>1134</td>\n",
       "      <td>0.896694</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1134</th>\n",
       "      <td>1135</td>\n",
       "      <td>0.896654</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1135 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      循环圈数     容量衰减率\n",
       "0        1  1.000000\n",
       "1        2  1.000250\n",
       "2        3  0.999858\n",
       "3        4  0.999316\n",
       "4        5  0.998557\n",
       "...    ...       ...\n",
       "1130  1131  0.896848\n",
       "1131  1132  0.896777\n",
       "1132  1133  0.896700\n",
       "1133  1134  0.896694\n",
       "1134  1135  0.896654\n",
       "\n",
       "[1135 rows x 2 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_require"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "108491c2",
   "metadata": {},
   "outputs": [],
   "source": [
    "func1=interp1d(df_input['循环圈数'],df_input['容量衰减率'],kind='cubic')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "5f73d769",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_require['预测容量衰减率']=func1(df_require['循环圈数'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "86a164a0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>循环圈数</th>\n",
       "      <th>容量衰减率</th>\n",
       "      <th>预测容量衰减率</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1.000250</td>\n",
       "      <td>0.999510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>0.999858</td>\n",
       "      <td>0.999026</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>0.999316</td>\n",
       "      <td>0.998549</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0.998557</td>\n",
       "      <td>0.998078</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1130</th>\n",
       "      <td>1131</td>\n",
       "      <td>0.896848</td>\n",
       "      <td>0.896898</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1131</th>\n",
       "      <td>1132</td>\n",
       "      <td>0.896777</td>\n",
       "      <td>0.896837</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1132</th>\n",
       "      <td>1133</td>\n",
       "      <td>0.896700</td>\n",
       "      <td>0.896775</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1133</th>\n",
       "      <td>1134</td>\n",
       "      <td>0.896694</td>\n",
       "      <td>0.896714</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1134</th>\n",
       "      <td>1135</td>\n",
       "      <td>0.896654</td>\n",
       "      <td>0.896654</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1135 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      循环圈数     容量衰减率   预测容量衰减率\n",
       "0        1  1.000000  1.000000\n",
       "1        2  1.000250  0.999510\n",
       "2        3  0.999858  0.999026\n",
       "3        4  0.999316  0.998549\n",
       "4        5  0.998557  0.998078\n",
       "...    ...       ...       ...\n",
       "1130  1131  0.896848  0.896898\n",
       "1131  1132  0.896777  0.896837\n",
       "1132  1133  0.896700  0.896775\n",
       "1133  1134  0.896694  0.896714\n",
       "1134  1135  0.896654  0.896654\n",
       "\n",
       "[1135 rows x 3 columns]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_require"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "582176ce",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEECAYAAADHzyg1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAxWUlEQVR4nO3deXwNZ/vH8c+Vk0giEoJYI/ad2tIopaKW4mlqK6kqVVT1qa6qFC1Kq7To0/qpKkpLq0prp5baao+99p1YI3YRJLl/f5wjVU0kyDE5yfV+vfLqnDkzc667yPfMfc/cI8YYlFJKKQA3qwtQSimVfmgoKKWUSqShoJRSKpGGglJKqUQaCkoppRJpKCillErkbnUBDyp37tymSJEiVpehlFIuY+PGjWeNMQFJvefyoVCkSBEiIiKsLkMppV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4l2GdRnWyMuYl9ULoZsCGt26lUcvRMQal/E+zf1AONMVdEJBD7wC/YzxpWAL8bY2Id9yN4GmOu37p3wRhzDhKvPrrlW+xPzHPD3p106yxAHP8djb2rqi9wRESKYh+DuI598sMIp7RUqTtoKCj1b57Y70249e3/L2PMUwAi8qsx5vytDR33EMQ4XvrxTzagkWPG1zs9if0+BXfHJalfYx87eMyx/jvgXeyD0tNE5Pk7rmxSyil0Qjyl7iAintj/bcQ6XvsZYy6lsNuDfqa7MSbOsSyA262b1kREjP5DVQ+JhoJSSqlEOtCslFIqkYaCUkqpRBoKSimlEmkoKKWUSqShoJRSKtH/AzWn7TAPYurbAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(df_require['循环圈数'],df_require['容量衰减率'],label='实际',color='red')\n",
    "plt.plot(df_require['循环圈数'],df_require['预测容量衰减率'],label='预测',color='blue')\n",
    "plt.xlabel('循环圈数')\n",
    "plt.ylabel('容量保持率')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "e7be3293",
   "metadata": {},
   "outputs": [],
   "source": [
    "import urllib.request"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "2ffe45fb",
   "metadata": {},
   "outputs": [],
   "source": [
    "url='https://www.baidu.com/'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "933e7d2f",
   "metadata": {},
   "outputs": [],
   "source": [
    "response=urllib.request.urlopen(url=url,timeout=0.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "5c713392",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "response.status"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "d7a06884",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "响应状态码为200\n"
     ]
    }
   ],
   "source": [
    "print(f'响应状态码为{response.status}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "96645f78",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "响应头信息是[('Accept-Ranges', 'bytes'), ('Cache-Control', 'no-cache'), ('Content-Length', '227'), ('Content-Security-Policy', \"frame-ancestors 'self' https://chat.baidu.com http://mirror-chat.baidu.com https://fj-chat.baidu.com https://hba-chat.baidu.com https://hbe-chat.baidu.com https://njjs-chat.baidu.com https://nj-chat.baidu.com https://hna-chat.baidu.com https://hnb-chat.baidu.com http://debug.baidu-int.com;\"), ('Content-Type', 'text/html'), ('Date', 'Mon, 23 Oct 2023 13:50:08 GMT'), ('P3p', 'CP=\" OTI DSP COR IVA OUR IND COM \"'), ('P3p', 'CP=\" OTI DSP COR IVA OUR IND COM \"'), ('Pragma', 'no-cache'), ('Server', 'BWS/1.1'), ('Set-Cookie', 'BD_NOT_HTTPS=1; path=/; Max-Age=300'), ('Set-Cookie', 'BIDUPSID=4F1124E3BA02FA90931E28466BD43EC2; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com'), ('Set-Cookie', 'PSTM=1698069008; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com'), ('Set-Cookie', 'BAIDUID=4F1124E3BA02FA90716F5D3391B63C9F:FG=1; max-age=31536000; expires=Tue, 22-Oct-24 13:50:08 GMT; domain=.baidu.com; path=/; version=1; comment=bd'), ('Traceid', '1698069008056637594616990038900896485319'), ('X-Ua-Compatible', 'IE=Edge,chrome=1'), ('Connection', 'close')]\n"
     ]
    }
   ],
   "source": [
    "print(f'响应头信息是{response.getheaders()}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "4e7f5fad",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'no-cache'"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "response.getheader('Cache-Control')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "7e37d03d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'bytes'"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "response.getheader('Accept-Ranges')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "ef735e9c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "b'<html>\\r\\n<head>\\r\\n\\t<script>\\r\\n\\t\\tlocation.replace(location.href.replace(\"https://\",\"http://\"));\\r\\n\\t</script>\\r\\n</head>\\r\\n<body>\\r\\n\\t<noscript><meta http-equiv=\"refresh\" content=\"0;url=http://www.baidu.com/\"></noscript>\\r\\n</body>\\r\\n</html>'"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "response.read()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "c4de8ec6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "b'pwh=python'"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bytes(urllib.parse.urlencode({'pwh':'python'}),encoding='utf-8')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "48d2543a",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LinearRegression"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "e2c892d6",
   "metadata": {},
   "outputs": [],
   "source": [
    "df2=pd.DataFrame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "5e188669",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: []\n",
       "Index: []"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "a24cc849",
   "metadata": {},
   "outputs": [],
   "source": [
    "list1=[i for i in range(1,101)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "b2c237cc",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1,\n",
       " 2,\n",
       " 3,\n",
       " 4,\n",
       " 5,\n",
       " 6,\n",
       " 7,\n",
       " 8,\n",
       " 9,\n",
       " 10,\n",
       " 11,\n",
       " 12,\n",
       " 13,\n",
       " 14,\n",
       " 15,\n",
       " 16,\n",
       " 17,\n",
       " 18,\n",
       " 19,\n",
       " 20,\n",
       " 21,\n",
       " 22,\n",
       " 23,\n",
       " 24,\n",
       " 25,\n",
       " 26,\n",
       " 27,\n",
       " 28,\n",
       " 29,\n",
       " 30,\n",
       " 31,\n",
       " 32,\n",
       " 33,\n",
       " 34,\n",
       " 35,\n",
       " 36,\n",
       " 37,\n",
       " 38,\n",
       " 39,\n",
       " 40,\n",
       " 41,\n",
       " 42,\n",
       " 43,\n",
       " 44,\n",
       " 45,\n",
       " 46,\n",
       " 47,\n",
       " 48,\n",
       " 49,\n",
       " 50,\n",
       " 51,\n",
       " 52,\n",
       " 53,\n",
       " 54,\n",
       " 55,\n",
       " 56,\n",
       " 57,\n",
       " 58,\n",
       " 59,\n",
       " 60,\n",
       " 61,\n",
       " 62,\n",
       " 63,\n",
       " 64,\n",
       " 65,\n",
       " 66,\n",
       " 67,\n",
       " 68,\n",
       " 69,\n",
       " 70,\n",
       " 71,\n",
       " 72,\n",
       " 73,\n",
       " 74,\n",
       " 75,\n",
       " 76,\n",
       " 77,\n",
       " 78,\n",
       " 79,\n",
       " 80,\n",
       " 81,\n",
       " 82,\n",
       " 83,\n",
       " 84,\n",
       " 85,\n",
       " 86,\n",
       " 87,\n",
       " 88,\n",
       " 89,\n",
       " 90,\n",
       " 91,\n",
       " 92,\n",
       " 93,\n",
       " 94,\n",
       " 95,\n",
       " 96,\n",
       " 97,\n",
       " 98,\n",
       " 99,\n",
       " 100]"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "id": "fee13172",
   "metadata": {},
   "outputs": [],
   "source": [
    "list2=[i*2+random.uniform(-0.01,0.05) for i in range(1,101)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "a3c8a5a9",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[2.0399761105948464,\n",
       " 4.02544657463814,\n",
       " 6.008583563260455,\n",
       " 8.039678334765446,\n",
       " 10.039834820105616,\n",
       " 12.04422025167222,\n",
       " 14.005267417979171,\n",
       " 16.02056757102088,\n",
       " 18.001454690375425,\n",
       " 20.039879483426322,\n",
       " 21.995474748163105,\n",
       " 24.02041246370193,\n",
       " 26.041552205125964,\n",
       " 28.015517117895424,\n",
       " 30.048810434107395,\n",
       " 32.01095014306092,\n",
       " 34.014659424007164,\n",
       " 35.99617530218824,\n",
       " 38.03676624945318,\n",
       " 40.046003655249635,\n",
       " 42.028034363032674,\n",
       " 44.007782872486395,\n",
       " 46.03019920263756,\n",
       " 48.04226433417977,\n",
       " 50.016619906929094,\n",
       " 51.99223601751039,\n",
       " 53.99484220881011,\n",
       " 56.0280822830477,\n",
       " 58.00499109819163,\n",
       " 59.99795604950865,\n",
       " 62.02224283772313,\n",
       " 64.00990847725201,\n",
       " 66.00245326077173,\n",
       " 67.99535957763185,\n",
       " 69.99287258293796,\n",
       " 72.03762760652538,\n",
       " 74.00763722587769,\n",
       " 75.9982762150061,\n",
       " 78.00627998339347,\n",
       " 80.03684119811552,\n",
       " 82.01059034361418,\n",
       " 84.04644715219008,\n",
       " 86.04645862480643,\n",
       " 87.99127688560708,\n",
       " 89.9993104802929,\n",
       " 91.99696935540858,\n",
       " 94.0466394575219,\n",
       " 96.04412055987706,\n",
       " 98.0448529360637,\n",
       " 100.0039054851887,\n",
       " 102.03877502539636,\n",
       " 103.99320745132155,\n",
       " 106.01834164286787,\n",
       " 108.0395624071013,\n",
       " 110.00142521014945,\n",
       " 112.0305527790016,\n",
       " 114.00511747840972,\n",
       " 116.0468130057446,\n",
       " 117.99585816870909,\n",
       " 120.04134208350061,\n",
       " 122.02294231332088,\n",
       " 123.99692049691312,\n",
       " 126.00219072039627,\n",
       " 127.99540586065501,\n",
       " 130.0377157987338,\n",
       " 132.04764247729204,\n",
       " 134.00182758060492,\n",
       " 136.00612026253904,\n",
       " 138.0186845108595,\n",
       " 140.02801063082487,\n",
       " 142.03320042571482,\n",
       " 144.03113811136691,\n",
       " 146.0155452759322,\n",
       " 148.0117164762243,\n",
       " 150.04171479598253,\n",
       " 152.01136986680854,\n",
       " 154.0112464823876,\n",
       " 156.00089317537478,\n",
       " 158.03829440821045,\n",
       " 160.01528187941054,\n",
       " 161.99057644080477,\n",
       " 164.01460031720194,\n",
       " 166.01090896413882,\n",
       " 168.0200297131081,\n",
       " 170.00039748385953,\n",
       " 172.03974429450065,\n",
       " 174.0376706962509,\n",
       " 176.03599897040752,\n",
       " 178.04622126828014,\n",
       " 180.0433021197002,\n",
       " 181.99612271314652,\n",
       " 184.0360534506808,\n",
       " 186.0400979620742,\n",
       " 188.03791739373534,\n",
       " 190.02452077076433,\n",
       " 192.0469136548361,\n",
       " 194.02493493335953,\n",
       " 196.02164836688647,\n",
       " 198.0008122043675,\n",
       " 199.99415693341376]"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "3aaaba8a",
   "metadata": {},
   "outputs": [],
   "source": [
    "df2['x']=pd.Series(list1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "02779293",
   "metadata": {},
   "outputs": [],
   "source": [
    "df2['y']=pd.Series(list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "id": "11a253fa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2.039976</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>4.025447</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>6.008584</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>8.039678</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>10.039835</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>96</td>\n",
       "      <td>192.046914</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>97</td>\n",
       "      <td>194.024935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>98</td>\n",
       "      <td>196.021648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>99</td>\n",
       "      <td>198.000812</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>100</td>\n",
       "      <td>199.994157</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      x           y\n",
       "0     1    2.039976\n",
       "1     2    4.025447\n",
       "2     3    6.008584\n",
       "3     4    8.039678\n",
       "4     5   10.039835\n",
       "..  ...         ...\n",
       "95   96  192.046914\n",
       "96   97  194.024935\n",
       "97   98  196.021648\n",
       "98   99  198.000812\n",
       "99  100  199.994157\n",
       "\n",
       "[100 rows x 2 columns]"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "id": "dd468318",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       1\n",
       "1       2\n",
       "2       3\n",
       "3       4\n",
       "4       5\n",
       "     ... \n",
       "95     96\n",
       "96     97\n",
       "97     98\n",
       "98     99\n",
       "99    100\n",
       "Name: x, Length: 100, dtype: int64"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2['x']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "id": "d424be7a",
   "metadata": {},
   "outputs": [],
   "source": [
    "lr=LinearRegression()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "id": "f831bbf2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>#sk-container-id-1 {color: black;background-color: white;}#sk-container-id-1 pre{padding: 0;}#sk-container-id-1 div.sk-toggleable {background-color: white;}#sk-container-id-1 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-1 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-1 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-1 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-1 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-1 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-1 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-1 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-1 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-1 div.sk-item {position: relative;z-index: 1;}#sk-container-id-1 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-1 div.sk-item::before, #sk-container-id-1 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-1 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-1 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-1 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-1 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-1 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-1 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-1 div.sk-label-container {text-align: center;}#sk-container-id-1 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-1 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LinearRegression()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LinearRegression</label><div class=\"sk-toggleable__content\"><pre>LinearRegression()</pre></div></div></div></div></div>"
      ],
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr.fit(np.array(df2['x']).reshape(-1,1),df2['y'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "id": "ef82be4f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9999998989234863"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr.score(np.array(df2['x']).reshape(-1,1),df2['y'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "id": "ae3feab4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2.00001399])"
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "8b49aadb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.019451603269473594"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr.intercept_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "id": "4c51a427",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhE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aH/B73mhO00sfU+AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(df2['x'],df2['y'])\n",
    "plt.xlabel('x')\n",
    "plt.ylabel('y')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "id": "86a68601",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1000.0264451])"
      ]
     },
     "execution_count": 122,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr.predict(np.array([500]).reshape(-1,1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "id": "937f8444",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1000.0264451 , 1420.02938236, 1836.03229165])"
      ]
     },
     "execution_count": 123,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr.predict(np.array([500,710,918]).reshape(-1,1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ff2fd86f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "32eaf7f4",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "90ab4c53",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "hide_input": false,
  "jupytext": {
   "cell_metadata_filter": "-all",
   "encoding": "# -*- coding: utf-8 -*-",
   "notebook_metadata_filter": "-all"
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "174px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
